﻿using Core.ValidateRules.Lib;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dto.Core.Config
{
    /// <summary>
    /// 属性模式配置
    /// </summary>
    public class PropertyPatternConfigDto:CommonBaseDto
    {
        #region 配置键 通过该字段实例化到具体的类

        /// <summary>
        /// 配置键
        /// <para>数据库类型：varchar(256) ; 数据库值：不允许为空</para>
        /// <para>通过该字段实例化到具体的类</para>
        /// </summary>
        private string? @key;

        /// <summary>
        /// 配置键
        /// <para>数据库类型：varchar(256) ; 数据库值：不允许为空</para>
        /// <para>通过该字段实例化到具体的类</para>
        /// </summary>
        [JsonProperty("key", Order = 1)]
        [ValidateRulesRequired(ErrorMessage = "{0}不允许为空", AllowEmptyStrings = false)]
        [Display(Name = "配置键")]
        public virtual string? @Key
        {
            get { return key; }
            set
            {
                key = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置键 通过该字段实例化到具体的类

        #region 配置名称

        /// <summary>
        /// 配置名称
        /// </summary>
        private string? @name;

        /// <summary>
        /// 配置名称
        /// </summary>
        [JsonProperty("name", Order = 2)]
        [Display(Name = "配置名称")]
        public virtual string? @Name
        {
            get { return name; }
            set
            {
                name = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置名称

        #region 配置分组键

        /// <summary>
        /// 配置分组键
        /// </summary>
        private string? @groupKey;

        /// <summary>
        /// 配置分组键
        /// </summary>
        [JsonProperty("group_key", Order = 3)]
        [Display(Name = "配置分组键")]
        public virtual string? @GroupKey
        {
            get { return groupKey; }
            set
            {
                groupKey = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置分组键

        #region 配置分组名称

        /// <summary>
        /// 配置分组名称
        /// </summary>
        private string? @groupName;

        /// <summary>
        /// 配置分组名称
        /// </summary>
        [JsonProperty("group_name", Order = 4)]
        [Display(Name = "配置分组名称")]
        public virtual string? @GroupName
        {
            get { return groupName; }
            set
            {
                groupName = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置分组名称

        #region 配置说明

        /// <summary>
        /// 配置说明
        /// </summary>
        private string? @description;

        /// <summary>
        /// 配置说明
        /// </summary>
        [JsonProperty("description", Order = 5)]
        [Display(Name = "配置说明")]
        public virtual string? @Description
        {
            get { return description; }
            set
            {
                description = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置说明

        #region 配置类型 加载配置的实体类类型

        /// <summary>
        /// 配置类型
        /// <para>数据库类型：varchar(256)</para>
        /// <para>加载配置的实体类类型</para>
        /// </summary>
        private string? @configType;

        /// <summary>
        /// 配置类型
        /// <para>数据库类型：varchar(256)</para>
        /// <para>加载配置的实体类类型</para>
        /// </summary>
        [JsonProperty("config_type", Order = 6)]
        [Display(Name = "配置类型")]
        public virtual string? @ConfigType
        {
            get { return configType; }
            set
            {
                configType = value;
                OnPropertyChanged();
            }
        }

        #endregion 配置类型 加载配置的实体类类型

        #region 是否启用 0:否;1:是

        /// <summary>
        /// 是否启用
        /// <para>数据库类型：tinyint ; 数据库默认值：1 ; 数据库值：不允许为空</para>
        /// <para>0:否;1:是</para>
        /// </summary>
        private bool? @isEnabled = true;

        /// <summary>
        /// 是否启用
        /// <para>数据库类型：tinyint ; 数据库默认值：1 ; 数据库值：不允许为空</para>
        /// <para>0:否;1:是</para>
        /// </summary>
        [JsonProperty("is_enabled", Order = 7)]
        [ValidateRulesRequired(ErrorMessage = "{0}不允许为空", AllowEmptyStrings = false)]
        [Display(Name = "是否启用")]
        public virtual bool? @IsEnabled
        {
            get { return isEnabled; }
            set
            {
                isEnabled = value;
                OnPropertyChanged();
            }
        }

        #endregion 是否启用 0:否;1:是

        #region 是否显示 0:否;1:是

        /// <summary>
        /// 是否显示
        /// <para>数据库类型：tinyint ; 数据库默认值：1 ; 数据库值：不允许为空</para>
        /// <para>0:否;1:是</para>
        /// </summary>
        private bool? @isVisible = true;

        /// <summary>
        /// 是否显示
        /// <para>数据库类型：tinyint ; 数据库默认值：1 ; 数据库值：不允许为空</para>
        /// <para>0:否;1:是</para>
        /// </summary>
        [JsonProperty("is_visible", Order = 8)]
        [ValidateRulesRequired(ErrorMessage = "{0}不允许为空", AllowEmptyStrings = false)]
        [Display(Name = "是否显示")]
        public virtual bool? @IsVisible
        {
            get { return isVisible; }
            set
            {
                isVisible = value;
                OnPropertyChanged();
            }
        }

        #endregion 是否显示 0:否;1:是
    }
}
